package com.singlemountain.gcommerce.web.account;


import com.singlemountain.gcommerce.domain.user.Userd;
import com.singlemountain.gcommerce.web.BaseController;
import com.singlemountain.gcommerce.web.BaseValidators;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class MyAccountController extends BaseController<Userd,BaseValidators> {



    @RequestMapping(value = URL_MY_ACCOUNT,method = RequestMethod.GET)
    public  String setUpPage(){
         return  VIEW_MY_ACCOUNT;
    }

    @RequestMapping(value = URL_MY_ACCOUNT,method = RequestMethod.POST)
    public  String handle(Userd userd){
         userd.persist();
        System.err.println("user"+userd.getEmail());
        return  VIEW_MY_ACCOUNT;
    }

    @ModelAttribute
    public Userd setModel(){
        return new Userd();
    }
}
